import request from '@/utils/request'

// 查询代理商信息列表
export function listInfo(query) {
  return request({
    url: '/agent/info/list',
    method: 'get',
    params: query
  })
}

// 查询代理商信息详细
export function getInfo(agentId) {
  return request({
    url: '/agent/info/' + agentId,
    method: 'get'
  })
}

// 新增代理商信息
export function addInfo(data) {
  return request({
    url: '/agent/info',
    method: 'post',
    data: data
  })
}

// 修改代理商信息
export function updateInfo(data) {
  return request({
    url: '/agent/info',
    method: 'put',
    data: data
  })
}

// 删除代理商信息
export function delInfo(agentId) {
  return request({
    url: '/agent/info/' + agentId,
    method: 'delete'
  })
}

// 查询代理区域
export function queryAgentArea(agentId){
  return request({
    url: '/agent/area/list/' + agentId,
    method: 'get'
  })
}

// 设置代理区域
export function setAgentArea(agentId, areas){
  return request({
    url: '/agent/area/set/' + agentId,
    method: 'post',
    data: areas
  })
}

// 下拉框选项数据
export function getOptionData() {
  return request({
    url: '/agent/info/getOptionData',
    method: 'get',
  })
}
